﻿Imports ICtagControl.frmStartCompleteBase
Public Class clsDbWire

    Public Sub ConnectWireDB()
        With wire_Server
            g_iDBconnResult = WireDBacs.Connect(.szDrive, .szIPadr, .szDsn, .szDbn, .szUid, .szPas, .iOver, .iPORT) 'ADD MIAO 2018/10/19
            If 1 <> g_iDBconnResult Then
                .szDrive = CStr(IIf("SQL Server" = .szDrive, "SQL Server", "SQL Server"))
                g_iDBconnResult = WireDBacs.Connect(.szDrive, .szIPadr, .szDsn, .szDbn, .szUid, .szPas, .iOver, .iPORT) 'ADD MIAO 2018/10/19
            End If
        End With
    End Sub

    Public Function GetWireLimitTime(ByVal AgNo As String, ByVal ManageNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT TOP 1 J_RQ, J_BZRQ "
        szSql &= "FROM [dbo].[tbXJJXRL] "
        szSql &= "WHERE J_KIND = '" & AgNo & "' "
        szSql &= "AND J_GLNO = '" & ManageNo & "' "
        szSql &= "AND J_QB = N'出库' "
        szSql &= "ORDER BY J_RQ"

        Dim dt As DataTable = WireDBacs.ExecuteSql(szSql, -1)

        If IsNothing(dt) Then
            GetWireLimitTime = New DataTable
        Else
            GetWireLimitTime = dt
        End If

    End Function
End Class
